package com.hongning.railway.ui.main.mine.partymember;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.hongning.railway.BR;
import com.hongning.railway.R;
import com.hongning.railway.databinding.FragmentPartyMemberMainBinding;
import com.hongning.railway.ui.adapter.BaseFragmentPagerAdapter;
import com.hongning.railway.ui.main.cadremanager.CadreManagerFragment;
import com.hongning.railway.ui.main.fragments.college.ExamCompleteFragment;
import com.hongning.railway.ui.main.fragments.college.ExamUnCompleteFragment;

import java.util.ArrayList;
import java.util.Arrays;

import me.goldze.mvvmhabit.base.BaseFragment;
import me.goldze.mvvmhabit.base.BaseViewModel;

/**
 * Author: zhangjing
 * DATA:2019-09-04 16:05
 * DESC:啥子党员测评哟 哎 脑壳都整昏了
 * email:zhangjingworkmol@163.com
 */
public class PartyMemberMainFragment extends BaseFragment<FragmentPartyMemberMainBinding, BaseViewModel> {
    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.fragment_party_member_main;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {
        super.initData();
        binding.ivLeft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().finish();
            }
        });
        initViewPager();
    }

    private void initViewPager() {
        ArrayList<Fragment> fragments=new ArrayList<>();
        String[] title={"测评问卷","测评结果"};
        fragments.add(QuestionFragment.newInstance());
        fragments.add(CheckReultFragment.newInstance());
        BaseFragmentPagerAdapter pagerAdapter = new BaseFragmentPagerAdapter(getChildFragmentManager(), fragments, Arrays.asList(title));
        binding.vpContent.setAdapter(pagerAdapter);
        binding.stlTitle.setViewPager(binding.vpContent,title);
    }
}
